/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundless.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author hendrikdekock
 */
@Entity
@Table(name = "FANTASYTEAMS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Fantasyteams.findAll", query = "SELECT f FROM Fantasyteams f"),
    @NamedQuery(name = "Fantasyteams.findById", query = "SELECT f FROM Fantasyteams f WHERE f.id = :id"),
    @NamedQuery(name = "Fantasyteams.findByName", query = "SELECT f FROM Fantasyteams f WHERE f.name = :name"),
    @NamedQuery(name = "Fantasyteams.findByWin", query = "SELECT f FROM Fantasyteams f WHERE f.win = :win"),
    @NamedQuery(name = "Fantasyteams.findByLose", query = "SELECT f FROM Fantasyteams f WHERE f.lose = :lose"),
    @NamedQuery(name = "Fantasyteams.findByTie", query = "SELECT f FROM Fantasyteams f WHERE f.tie = :tie"),
    @NamedQuery(name = "Fantasyteams.findByBye", query = "SELECT f FROM Fantasyteams f WHERE f.bye = :bye"),
    @NamedQuery(name = "Fantasyteams.findByPowerlevel", query = "SELECT f FROM Fantasyteams f WHERE f.powerlevel = :powerlevel")})
public class Fantasyteams implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fantasyteams")
    private Collection<Gamehistory> gamehistoryCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fantasyteams1")
    private Collection<Gamehistory> gamehistoryCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "senderteamid")
    private Collection<Traderequests> traderequestsCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "receiverteamid")
    private Collection<Traderequests> traderequestsCollection1;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "fantasyteams")
    private Collection<Playerteam> playerteamCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "NAME")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Column(name = "WIN")
    private int win;
    @Basic(optional = false)
    @NotNull
    @Column(name = "LOSE")
    private int lose;
    @Basic(optional = false)
    @NotNull
    @Column(name = "TIE")
    private int tie;
    @Column(name = "BYE")
    private Integer bye;
    @Basic(optional = false)
    @NotNull
    @Column(name = "POWERLEVEL")
    private int powerlevel;
    @JoinColumn(name = "LEAGUEID", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private League leagueid;
    @JoinColumn(name = "OWNERID", referencedColumnName = "ID")
    @ManyToOne(optional = false)
    private Account ownerid;

    public Fantasyteams() {
    }

    public Fantasyteams(Integer id) {
        this.id = id;
    }

    public Fantasyteams(Integer id, String name, int win, int lose, int tie, int powerlevel) {
        this.id = id;
        this.name = name;
        this.win = win;
        this.lose = lose;
        this.tie = tie;
        this.powerlevel = powerlevel;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getWin() {
        return win;
    }

    public void setWin(int win) {
        this.win = win;
    }

    public int getLose() {
        return lose;
    }

    public void setLose(int lose) {
        this.lose = lose;
    }

    public int getTie() {
        return tie;
    }

    public void setTie(int tie) {
        this.tie = tie;
    }

    public Integer getBye() {
        return bye;
    }

    public void setBye(Integer bye) {
        this.bye = bye;
    }

    public int getPowerlevel() {
        return powerlevel;
    }

    public void setPowerlevel(int powerlevel) {
        this.powerlevel = powerlevel;
    }

    public League getLeagueid() {
        return leagueid;
    }

    public void setLeagueid(League leagueid) {
        this.leagueid = leagueid;
    }

    public Account getOwnerid() {
        return ownerid;
    }

    public void setOwnerid(Account ownerid) {
        this.ownerid = ownerid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Fantasyteams)) {
            return false;
        }
        Fantasyteams other = (Fantasyteams) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "boundless.entities.Fantasyteams[ id=" + id + " ]";
    }

    @XmlTransient
    public Collection<Gamehistory> getGamehistoryCollection() {
        return gamehistoryCollection;
    }

    public void setGamehistoryCollection(Collection<Gamehistory> gamehistoryCollection) {
        this.gamehistoryCollection = gamehistoryCollection;
    }

    @XmlTransient
    public Collection<Gamehistory> getGamehistoryCollection1() {
        return gamehistoryCollection1;
    }

    public void setGamehistoryCollection1(Collection<Gamehistory> gamehistoryCollection1) {
        this.gamehistoryCollection1 = gamehistoryCollection1;
    }

    @XmlTransient
    public Collection<Traderequests> getTraderequestsCollection() {
        return traderequestsCollection;
    }

    public void setTraderequestsCollection(Collection<Traderequests> traderequestsCollection) {
        this.traderequestsCollection = traderequestsCollection;
    }

    @XmlTransient
    public Collection<Traderequests> getTraderequestsCollection1() {
        return traderequestsCollection1;
    }

    public void setTraderequestsCollection1(Collection<Traderequests> traderequestsCollection1) {
        this.traderequestsCollection1 = traderequestsCollection1;
    }

    @XmlTransient
    public Collection<Playerteam> getPlayerteamCollection() {
        return playerteamCollection;
    }

    public void setPlayerteamCollection(Collection<Playerteam> playerteamCollection) {
        this.playerteamCollection = playerteamCollection;
    }
    
}
